/**
 * 
 */
package sailing.io.file;

import java.io.File;

import javax.swing.filechooser.FileFilter;

/**
 * @author kevin
 * 
 */
public class ExcelFileFilter extends FileFilter {

	private static final String fileExtName = "xls";
	private static final String fileExtName2 = "xlsx";

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.swing.filechooser.FileFilter#accept(java.io.File)
	 */
	@Override
	public boolean accept(File f) {
		if (f.isDirectory())
			return true;

		String path = f.getAbsolutePath().toLowerCase();
		if (path.endsWith(fileExtName) || path.endsWith(fileExtName2)) {
			return true;
		}
		return false;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see javax.swing.filechooser.FileFilter#getDescription()
	 */
	@Override
	public String getDescription() {
		return null;
	}

}
